from sqlalchemy import Column, String, DateTime, DECIMAL, Integer

from config.database import Base


class StatStock(Base):
    """
    股票统计表
    """

    __tablename__ = 'stock_stat_stock'
    __table_args__ = {'comment': '股票交易统计表'}
    account_tag = Column(String(64), primary_key=True, nullable=False, comment='股票账号标签')
    stock_code = Column(String(20), primary_key=True, nullable=False, comment='证券代码')
    stock_name = Column(String(100), nullable=True, comment='证券名称')
    total_buy_amount = Column(DECIMAL(20, 2), nullable=True, comment='累计买入金额')
    total_buy_quantity = Column(Integer, nullable=True, comment='累计买入数量')
    total_sell_amount = Column(DECIMAL, nullable=True, comment='累计卖出金额')
    total_sell_quantity = Column(Integer, nullable=True, comment='累计卖出数量')
    profit = Column(DECIMAL(20, 2), nullable=True, comment='盈利')
    create_time = Column(DateTime, nullable=True, comment='创建时间')
